package ae.pcfc.cldos.online.common.delegate.provider;

import java.util.Date;
import java.util.List;

import ae.pcfc.cldos.online.common.clddb.domain.FnpServiceMaster;
import ae.pcfc.cldos.online.common.delegate.BaseDelegate;
import ae.pcfc.cldos.online.common.delegate.FnpGSDelegate;
import ae.pcfc.cldos.online.common.etksdb.domain.Client;
import ae.pcfc.cldos.online.common.etksdb.domain.User;
import ae.pcfc.cldos.online.common.exception.BadAppException;
import ae.pcfc.cldos.online.common.exception.GSAppException;
import ae.pcfc.cldos.online.common.exception.NoSuchCompanyException;
import ae.pcfc.cldos.online.common.facade.FnpGSFacade;
import ae.pcfc.cldos.online.common.tscdb.domain.TTscClientCompany;
import ae.pcfc.cldos.online.common.vo.FnpDefaultParamsVO;
import ae.pcfc.cldos.online.common.vo.FnpParamMapperVO;
import ae.pcfc.cldos.online.common.vo.ep.peyment.PaymentAdviceRequestVO;
import ae.pcfc.cldos.online.common.vo.ep.peyment.PaymentAdviceResponseVO;
import ae.pcfc.cldos.online.fnp.exception.FNPException;
import ae.pcfc.cldos.online.fnp.service.client.vo.FNPAccountTypeVO;
import ae.pcfc.cldos.online.fnp.service.client.vo.FNPCatalogVO;
import ae.pcfc.cldos.online.fnp.service.client.vo.FNPParameterVO;
import ae.pcfc.cldos.online.fnp.service.client.vo.FNPPaymentAdviceReqVO;
import ae.pcfc.cldos.online.fnp.service.client.vo.FNPPaymentAdviceRspnsVO;
import ae.pcfc.cldos.online.fnp.service.client.vo.FNPPrepaidTransactionVO;
import ae.pcfc.cldos.online.gs.service.client.vo.GSFinancialDataVO;

/**
 * 
 * @author akhader
 *
 */
public class FnpGSDelegateImpl extends BaseDelegate implements FnpGSDelegate {

	/* (non-Javadoc)
	 * @see ae.pcfc.cldos.online.common.delegate.FnpDelegate#getClientById(java.lang.Long)
	 */
	public Client getClientById(Long clientId) {
		return getServiceLocator().getFacadeService(FnpGSFacade.class).getClientById(clientId);
	}

	/* (non-Javadoc)
	 * @see ae.pcfc.cldos.online.common.delegate.FnpDelegate#findUserByUserName(java.lang.String)
	 */
	public User findUserByUserName(String userName) {
		return getServiceLocator().getFacadeService(FnpGSFacade.class).findUserByUserName(userName);
	}

	/* (non-Javadoc)
	 * @see ae.pcfc.cldos.online.common.delegate.FnpDelegate#getCompanyByTrakheesId(java.lang.String)
	 */
	public TTscClientCompany getCompanyByTrakheesId(String trakheesId) {
		return getServiceLocator().getFacadeService(FnpGSFacade.class).getCompanyByTrakheesId(trakheesId);
	}
	/**
	 * @return List<FNPCatalogVO>
	 * @throws FNPException
	 * @{@link Parameter} List<String> fnpServiceCodeList
	 */
	public List<FNPCatalogVO> retreiveFNPCatalog(List<String> fnpServiceCodeList){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).retreiveFNPCatalog(fnpServiceCodeList); 
	}
	/**
	 * @param List<String> serviceIdList
	 * @return List<FNPParameterVO>
	 * @throws FNPException
	 */
	public List<FNPParameterVO> retreiveFNPParameters(List<String> serviceIdList){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).retreiveFNPParameters(serviceIdList);
	}
	/**
	 * @param fnpPaymentAdviceReqVO
	 * @return FNPPaymentAdviceRspnsVO
	 * @throws FNPException
	 */
	public FNPPaymentAdviceRspnsVO generatePaymentAdvice(FNPPaymentAdviceReqVO fnpPaymentAdviceReqVO){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).generatePaymentAdvice(fnpPaymentAdviceReqVO);
	}
	/**
	 * @param clentId
	 * @return FNPAccountTypeVO
	 * @throws FNPException
	 */
	public FNPAccountTypeVO enquireDeposits(String clentId){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).enquireDeposits(clentId);
	}
	/**
	 * @param clientLicenseNumber
	 * @return
	 */
	public GSFinancialDataVO retreiveFinancialData(String clientLicenseNumber){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).retreiveFinancialData(clientLicenseNumber);
	}
	/**
	 * @param serviceCode
	 * @return List<FnpServiceMaster>
	 */
	public List<FnpServiceMaster> getFnpCodeByServiceCode(String serviceCode){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).getFnpCodeByServiceCode(serviceCode);
	}
	/* (non-Javadoc)
	 * @see ae.pcfc.cldos.online.common.delegate.FnpGSDelegate#generatePayment(java.lang.String, java.lang.String, java.lang.String)
	 */

//	public FNPPaymentAdviceRspnsVO generatePayment(String appId, String userName, String visaService,List<FNPParameterVO> fnpParams){
//		return getServiceLocator().getFacadeService(FnpGSFacade.class).generatePayment(appId,userName,visaService,fnpParams);
//	}

	/**
	 * @param appId
	 * @param userName
	 * @param visaService
	 * @return
	 */
	public FNPPaymentAdviceRspnsVO previewPaymentAdvice(String userName, String visaService,List<FNPParameterVO> fnpParams){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).previewPaymentAdvice(userName,visaService,fnpParams);
	}
	/* (non-Javadoc)
	 * @see ae.pcfc.cldos.online.common.delegate.FnpGSDelegate#insertAll(java.util.List, java.lang.String)
	 */
	public void insertAll(List<FNPCatalogVO> fnpCatalogs, String serviceCode){
		 getServiceLocator().getFacadeService(FnpGSFacade.class).insertAll(fnpCatalogs, serviceCode);
	}

	
	public PaymentAdviceResponseVO previewPaymentInformation(
			PaymentAdviceRequestVO paymentAdviceRequestVO) throws BadAppException,NoSuchCompanyException,GSAppException,FNPException{
		return getServiceLocator().getFacadeService(FnpGSFacade.class).previewPaymentInformation(paymentAdviceRequestVO);
	}
	
	public List<FNPCatalogVO> getFnpCatalogVOsByServiceCode(String localServiceCode){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).getFnpCatalogVOsByServiceCode(localServiceCode);
	}
	/**
	 * @return
	 */
	public  List<FnpDefaultParamsVO> getDefaultParams(){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).getDefaultParams();
	}

	/**
	 * @param fnpParamMappers
	 * @param serviceIds
	 */
	public void saveParamMapping(List<FnpParamMapperVO> fnpParamMappers, List<String> serviceIds){
		getServiceLocator().getFacadeService(FnpGSFacade.class).saveParamMapping(fnpParamMappers, serviceIds);
	}
	/* (non-Javadoc)
	 * @see ae.pcfc.cldos.online.common.delegate.FnpGSDelegate#retreiveAllFNPParameters(java.util.List)
	 */
	public List<FNPParameterVO> retreiveAllFNPParameters(List<String> serviceIdList){
		return getServiceLocator().getFacadeService(FnpGSFacade.class).retreiveAllFNPParameters(serviceIdList);
	}
	/**
	 * @param userName
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<FNPPrepaidTransactionVO> enquireDepositTransaction(String userName, Date startDate, Date endDate) {
		return getServiceLocator().getFacadeService(FnpGSFacade.class).enquireDepositTransaction(userName, startDate, endDate);
	}
}
